
//
// Created by d11626 on 2024/4/30.
//

#include <iostream>
#include "Person.h"


void methond1(Person p){
    std::cout<< p.get_name()<<std::endl;
}

void methond2(Person& p){

}

void methond3(Person* p){
    p = new Person("innner");
}

void methond4(Person*& p){
    p = new Person("innner");
}

void meth1(const Person p) {
    Person k;
   // p.age = 15;  //错误
   // p = k;        //错误
   // s
}

void meth( Person p) {
    Person k;
    p.age = 15;
    p = k;
}


int main(){
    Person p1("zhangsan");
    //p1.sayHello();
    methond1(p1);
    methond2(p1);
    methond3(&p1);


    auto* p2 = new Person("lisi");
    methond1(*p2);
    methond2(*p2);
    methond3(p2);
    std::cout<< "after methond3 p2 name:"<< p2->get_name()<<std::endl;
    methond4(p2);
    std::cout<< "after methond4 p2 name:"<< p2->get_name()<<std::endl;
}